package helper

import (
	"github.com/gin-gonic/gin"
	"lover/http/api/dto"
	"net/http"
)

func ErrorWithMsg(ctx *gin.Context, code int, msgKey string) {
	res := dto.Response{
		Code:    code,
		Message: msgKey,
	}
	ctx.JSON(http.StatusOK, res)
	ctx.Abort()
}

func SuccessData(ctx *gin.Context, data any) {
	res := dto.Response{
		Code:    200,
		Message: "success",
		Data:    data,
	}
	ctx.JSON(http.StatusOK, res)
	ctx.Abort()
}
